set theHome to (path to "dlib" from user domain as text)
set theRoot to (path to "dlib" from local domain as text)
set theWord to displayed name of (info for (path to "dlib" from user domain))
set theList to {¬
word ((number of words in theHome) - 1) of theHome & "/" & theWord, ¬
first word of theRoot & "/" & theWord, ¬
last word of displayed name of (info for (path to "trsh" from user domain))}
set hadLogin to false
set theOption to 0
set theResult to 1
try
set theChoice to choose from list theList with prompt "" default items item 1 of theList
if (theChoice as text) is equal to (item 1 of theList as text) then
set theOption to 1
end if
if (theChoice as text) is equal to (item 2 of theList as text) then
set theOption to 2
end if
if (theChoice as text) is equal to (item 3 of theList as text) then
set theOption to 3
set theResult to 0
end if
end try
if ( theOption is not 0 ) then
do shell script "/bin/bash -c " & quoted form of theQuitScript
do shell script "/bin/bash -c " & quoted form of theHomeRemove
try
if ((count of (list folder ("/Library/Contextual Menu Items/Ittec.plugin" as POSIX file))) > 0) then
set theFlag to 1
try
repeat while ( theFlag is not 0 )
if ( theOption is 2 ) then
do shell script "/bin/bash -c " & quoted form of ( theRootRemove & theRootScript ) with administrator privileges
set theResult to 0
set theOption to 0
else
do shell script "/bin/bash -c " & quoted form of theRootRemove with administrator privileges
end if
set theFlag to 0
end repeat
on error theString number theNumber
if ( theNumber < 0 ) then
set theResult to 2
set theOption to 0
set theFlag to 0
else
beep
end if
end try
end if
end try
tell application "System Events"
repeat with theItem in login items
if path of theItem ends with "Ittec.app" then
set hadLogin to true
end if
end repeat
delete (every login item whose path ends with "Ittec.app")
end tell
end if
repeat while ( theOption is 2 )
try
do shell script "/bin/bash -c " & quoted form of theRootScript with administrator privileges
if ( hadLogin ) then
do shell script "/usr/bin/defaults write loginwindow AutoLaunchedApplicationDictionary -array-add " & quoted form of "{ Hide = 0 ; Path = /Library/PreferencePanes/Ittec.prefPane/Contents/Resources/Ittec.app ; }" & " ;"
end if
set theResult to 0
set theOption to 0
on error theString number theNumber
if ( theNumber < 0 ) then
set theOption to 1
end if
end try
end repeat
if ( theOption is 1 ) then
try
do shell script "/bin/bash -c " & quoted form of theHomeScript
if ( hadLogin ) then
do shell script "/usr/bin/defaults write loginwindow AutoLaunchedApplicationDictionary -array-add " & quoted form of (("{ Hide = 0 ; Path = " & (POSIX path of (path to "dtop" from user domain)) as text) & "Library/PreferencePanes/Ittec.prefPane/Contents/Resources/Ittec.app ; }") & " ;"
end if
set theResult to 0
end try
end if
do shell script "/bin/rm -rf /tmp/Ittec_Library/"
if ( theResult is not 0 ) then
activate application "Finder"
activate application "Installer"
error number theResult
end if
end tell
'
then
exit 1
fi
# remove temporary files
/bin/rm -rf /tmp/Ittec_Library/
# check to see if preference file exists
if [ -f ~/Library/Preferences/com.balance.ittec.plist ]; then